#!/usr/bin/python

import manpa
from selenium.webdriver.common.by import By

mp = manpa.Manpa(isDebug=True)
with mp.open_selenium_client() as driver:
    driver.get_and_wait("https://kernel.org")
    atag = driver.find_elements(By.XPATH, value="//a[text()='tarball']")[0]
    ret = driver.click_for_download_information_or_downloaded_file(atag)
    if ret[0]:
        flag = ret[0]
        url = ret[1]
        filename = ret[2]
        print(str(flag) + " : " + url + " : " + filename)
    else:
        flag = ret[0]
        fullfn = ret[1]
        print(str(flag) + " : " + fullfn)
